package name.fowler.refactoring.simplestore.model.pricecode;

public abstract class PriceCode {

    protected abstract int getIncludedDays();
    protected abstract double getBaseCost();
    protected abstract double getCostPerDay();
    protected abstract int getBaseBonus();
    protected abstract int getExtraBonusDays();
    protected abstract int getExtraBonus();

    public double getAmount(int daysRented) {
        double result = getBaseCost();
        if (daysRented > getIncludedDays()) {
            result += (daysRented - getIncludedDays()) * getCostPerDay();
        }
        return result;
    }

    public int getBonus(int daysRented) {
        int result = getBaseBonus();
        if (daysRented > getExtraBonusDays()) {
            result += getExtraBonus();
        }
        return result;
    }
}
